import { GET_LIST_DATA } from './actions-type'
import axios from 'axios';
import { CHANGEREADYSTATE } from 'component/ScrollView/scrollViewActionsType'
export const getListData = (obj) => async (dispatch, getState) => {

    dispatch({
        type: CHANGEREADYSTATE,
        obj: false
    })

    let url = '/json/homelist.json'
    if (obj.filterData || getState().contentListReducer.filterData) {
        url = '/json/listparams.json'
    }
    let res = await axios({
        method: 'get',
        url: url
    })
    dispatch({
        type: CHANGEREADYSTATE,
        obj: true
    })
    dispatch({
        type: GET_LIST_DATA,
        filterData: obj.filterData,
        toFirstPage: obj.toFirstPage,
        obj: res.data
    })
}